/*
 * =====================================================================================
 *
 *       Filename:  main.cpp
 *
 *        Version:  1.0
 *        Created:  29/09/13 00:10:20
 *
 *         Author:  LIU RENSHENG (A0105649B), roastedbill@gmail.com
 *   Organization:  NUS, SoC
 *
 * =====================================================================================
 */

/*******************************************************************************
 *   This main function simply generate the mainWindow of GUI and start work   *
 *       If TaskLine is running, a new one is not allowed to be execute        *
 *******************************************************************************/

#include "mainWindow.h"
#include <QtWidgets/QApplication>
#include <QSharedMemory>

//@author A0105649B
int main(int argc, char *argv[])
{
        const int ONE_INSTANCE_MODE = 1;
        const QString APP_NAME = "TaskLine";

        int ret = 0;
        QSharedMemory singletonCheck(APP_NAME);

        singletonCheck.create(ONE_INSTANCE_MODE);
        if(singletonCheck.error() != QSharedMemory::AlreadyExists){
                QApplication app(argc, argv);
                mainWindow window;
                window.show();
                ret = app.exec();
        }
        return ret;
}

